import http from '@/utils/http'

/*存量包*/


/*产品列表*/ 
export const getProductList =  (params:any)=>{
    return http.post('/api/product/page',params)
}
// 查询全部
export const getProductListAll =  (params:any)=>{
    return http.post('/api/product/list',params)
}

export const  addProduct =  (params:any)=>{
    return http.post('/api/product/saveOrUpdate',params)
}
//图片上传
export const upload = (params: any) => {
    return http.filePost('/api/attachment/upload',params)
}
// 图片附件上传-新增产品
export const uploadImg = (params: any) => {
    return http.post('/api/product/saveOrUpdateAttachment',params)
}

export const delProduct = (params: any) => {
    return http.delete('/api/product/delete',params)
}
// 产品附件删除
export const delAttachment = (params: any) =>http.delete('/api/product/deleteAttachment',params)
export const getProductinfo = (params: any) => {
    return http.getRestApi('/api/product/detail',params)

}

export const attachmentUploadApiPost = (params: any) => {
    return http.newPost('/api/attachment/upload',params)

}

/*首链配置*/ 

export const  getProductCnfList=  (params:any)=>{
    return http.post('/api/product/recommendation/page',params)
}

export const  addproductCnf=  (params:any)=>{
    return http.post('/api/product/recommendation/saveOrUpdate',params)
}
export const  addproductCnfUrl= async (params:any)=>{
    return http.post('/api/product/recommendation/saveOrUpdateRelation',params)
}
export const  delCnfPeoduct=  (params:any)=>{
    return http.delete('/api/product/recommendation/delete',params)
}
export const  getCnfProductInfo=  (params:any)=>{
    return http.getRestApi('/api/product/recommendation/detail',params)
}

// 删除关联产品项
export const  deleteRelation=  (params:any)=>{
    return http.delete('/api/product/recommendation/deleteRelation',params)
}


/*供应商*/

export const  getSupplier=  (params:any)=>{
    return http.post('/api/supplier/page',params)
}

export const  getSupplierAll=  (params:any)=>{
    return http.post('/api/supplier/list',params)
}

/*订单板块*/
export const getOrderList = (params: any) => {
    let obj = { ...params }
    delete obj.isShow
    return http.post(`/api/inventoryPackage/page?isShow=${params.isShow}`,obj)
}
export const getOrderListHide = (params: any) => {
    let obj = { ...params }
    delete obj.isShow
    return http.post(`/api/inventoryPackage/page?isShow=${params.isShow}`,obj)
}



export const  getOrderInfo=  (params:any)=>{
    return http.getRestApi('/api/inventoryPackage/detail',params)
}


/**************************************产品出单统计信息管理-API************************************* */
export const  getProductStatisticsPage=  (params:any)=>{
    return http.post('/api/inventoryPackage/productStatistics/page',params)
}
/**产品统计导出 */
export const  getExportInventoryPackageProductStatisticsPost=  (params:any)=>{
    return http.post('/api/export/exportInventoryPackageProductStatistics',params)
}